<#assign us = fn.service('loginUser')>
<#assign changePwdLink = fn.jsLink('/espirit/eap/sa/user._changePassword','','_popupTab_Change Password')>

<div class="leftMenu">
<div class="pane-header">
	<#assign user = us.loginUser!>
	${user.code!user.name}
</div>
<#if us.hasLinkPermission(fn.linkNoBase('/espirit/eap/manager/menu.search',true),false)>
	<span class="selfDefineLink menuLeft"><a href="javascript:void(0)"
		title="<@i18n name='model.espirit.eap.manager.menu.menuDef'/>" 
		onclick="openMainTab('${fn.link('/espirit/eap/manager/menu.search')}','<@i18n name='model.espirit.eap.manager.menu'/>','model.espirit.eap.manager.menu');stopEvent(event)">
		<div class="selfDefineIcon"></div>
		</a>
	</span>
</#if>

<div class="jleftmenuback"></div>
<div id="leftMenu" class="jleftmenu">


<#assign menuData=fn.service('espirit.eap.manager.menu').searchMenuList(2)>
<#list menuData as menuItem>
	<h3><@i18n name=menuItem.text/></h3>

	<div>
		<ul>
	<#list menuItem.children as childItem>
		<#if childItem.href??>
			<li><a href="javascript:void(0)" onclick="selectMenu(this,'${childItem.href}','${childItem.i18n!}','${childItem.text}')">${childItem.text}</a></li>
		<#else>
			<#list childItem.children as subChildItem>
				<li><a href="javascript:void(0)" onclick="selectMenu(this,'${subChildItem.href!''}','${subChildItem.i18n!''}','${subChildItem.text}')">${subChildItem.text}</a></li>
			</#list>
		</#if>
	</#list>
		</ul>
	</div>
</#list>

	<h3><@i18n name="menu.user"/></h3>
	<div>
		<ul>
			<#assign languages = fn.service('i18n').languages>
			<#list languages as language>
				<#assign fieldI18nKey = fn.service('model').getModelFieldI18nKey('espirit.eap.manager.i18n', language + 'Name')>
				<li><a href='${fn.link('/espirit/index')}?request_locale=${language}'><@i18n name=fieldI18nKey locale=language/></a></li>
			</#list>
			<li><a id="_changePassword" href="javascript:void(0)" onclick="openMainTab('${fn.link('/espirit/eap/sa/user._changePassword')}','<@i18n name='action.changePassword'/>','action.changePassword');void(0);"><@i18n name="action.changePassword"/></a></li>
			<li><a href='${fn.link('/espirit/eap/sa/user.logout')}'><@i18n name="commons.logout"/></a></li>
		</ul>
	</div>
</div>
<script>
$(document).ready(function(){
	when('$.fn.accordion', function() {
		$('#leftMenu').show().accordion({
			collapsible: true,
			autoHeight: false,
			fillSpace: false
		});
	});
	when('fixPlaceholderDefect', function() {
		$('#partItemSearch').attr('placeholder','<@i18n name="header.menu.searchPartItem"/>');
		fixPlaceholderDefect($('#partItemSearch'));
	});
});
</script>
</div>